import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/admin/index',
    children:[
      {
        path: '/admin/index',
        component: () => import('../views/AdminIndexView.vue')
      },
      {
        path: '/admin/account/user',
        component: () => import('../views/admin/account/UsersManagementView.vue')
      },
      {
        path: '/admin/account/user/add-new',
        component: () => import('../views/admin/account/UserAddNewView.vue')
      },
      {
        path: '/admin/account/user/userInfo',
        component: () => import('../views/admin/account/UserInfoView.vue')
      },
      {
        path: '/admin/account/login-log',
        component: () => import('../views/admin/account/LoginLogListView.vue')
      },
      {
        path: '/admin/ListDish',
        component: () => import('../views/dishes/ListDish.vue')
      },
      {
        path: '/admin/InsertDish',
        component: () => import('../views/dishes/InsertDish.vue')
      },
      {
        path: '/admin/mall/order/order-list',
        component: () => import('../views/orders/LookOrderList.vue')
      },
      {
        path: '/admin/mall/order/order-details',
        component: () => import('../views/orders/OrderDetailsList.vue')
      },
      {
        path: '/admin/stock/purchase',
        component: () => import('../views/stock/purchase.vue')
      },
      {
        path: '/admin/stock/stockout',
        component: () => import('../views/stock/stockout.vue')
      },
      {
        path: '/admin/table',
        component: () => import('../views/table/table.vue')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/front',
    component: () => import('../views/front/FrontHomeView.vue'),
    children:[
      {
        path: '/index',
        component: () => import('../views/front/IndexView.vue')
      },{
        path: '/call-number',
        component: () => import('../views/front/CallNumberView.vue')
      }, {
        path: '/call-number/retain-number',
        component: () => import('../views/front/RetainNumberView.vue')
      }, {
        path: '/take-orders',
        component: () => import('../views/front/TakeOrdersView.vue')
      }, {
        path: '/check-orders',
        component: () => import('../views/front/CheckOrdersView.vue')
      },{
        path: '/completed-orders',
        component: () => import('../views/front/CompletedOrdersView.vue')
      }, {
        path: '/cash-register',
        component: () => import('../views/front/CashRegisterView.vue')
      }
    ]
  }


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
